﻿namespace ExcelAutomator.Validation
{
	public class StringValidator : BaseValidator
	{
		public string Value { get; protected set; }
		public string FieldName { get; private set; }

		public StringValidator(string value, string fieldName)
		{
			Value = value;
			FieldName = fieldName;
		}

		public StringValidator IsNotNullOrEmpty()
		{
			if (Value.IsNOE())
			{
				SetFailure(string.Format("Value '{0}' of field '{1}' is null or empty.", Value, FieldName), "IsNotNullOrEmpty");
			}
			return this;
		}

		public StringValidator ContainsNot(string expression)
		{
			if (Value.Contains(expression))
			{
				SetFailure(string.Format("Value '{0}' of field '{1}' contains invalid expression '{2}'", Value, FieldName, expression), "IsNotNullOrEmpty");
			}
			
			return this;
		}
	}

	public static class StringValidatorExtensions
	{
		
	}
}